#include<stdio.h>
#include<unistd.h>


int global_val = 10;
int main(int argc, char const *argv[])
{

    int locate_val = 100;
    __pid_t pid = fork();
    printf("child process pid:%d\n",pid); 

    if (pid == 0)
    {
        printf("child process running...\n");
    }
    else
    {
        printf("father process running...\n");
    }


    if (pid == 0)
    {
        global_val *= 2;
        locate_val *= 2;
    }
    else
    {
        global_val *= 3;
        locate_val *= 3;
    }

    printf("global value:%d\n",global_val);
    printf("locate value:%d\n",locate_val);

    if (pid == 0)
    {
        printf("child global value:%d\n",global_val);
        printf("child locate value:%d\n",locate_val);
    }
    else
    {
        printf("father global value:%d\n",global_val);
        printf("father locate value:%d\n",locate_val);
        sleep(30);
    }

    return 0;
}
